<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../static/css/amazeui.min.css"/>
    <link rel="stylesheet" href="../static/css/admin.css"/>
</head>

<body>
<div id="table">
    <router-view>
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">新闻管理</strong><small></small>
                </div>
            </div>

            <hr>

            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                            <button class="am-btn am-btn-default" @click="add1"><span
                                    class="am-icon-plus"></span>新增
                            </button>
                        </div>

                        <div class="am-btn-group am-btn-group-xs">
                            <button type="button" class="am-btn am-btn-default" @click="delectByIds"><span
                                    class="am-icon-plus"></span>
                                批量删除
                            </button>
                        </div>

                    </div>
                </div>
                <div class="am-u-sm-12 am-u-md-3">

                </div>
                <div class="am-u-sm-12 am-u-md-3">
                    <div class="am-input-group am-input-group-sm">
                        <input type="text" v-model="title" class="am-form-field" placeholder="请输入新闻标题">
                        <span class="am-input-group-btn">
								<button class="am-btn am-btn-default" type="button" @click="all">搜索</button>
							</span>
                    </div>
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12">
                    <template>
                        <el-table :data="news" style="width: 100%" @selection-change="choice">
                            <el-table-column type="selection" width="50">
                            </el-table-column>
                            <el-table-column type="index" label="序号" width="50">
                            </el-table-column>
                            <el-table-column prop="title" label="标题" :show-overflow-tooltip='true' width="120">
                            </el-table-column>
                            <el-table-column prop="author" label="作者" width="90">
                            </el-table-column>
                            <el-table-column prop="sort" label="分类" width="100">
                            </el-table-column>
                            <el-table-column prop="time" label="发表时间" width="180">
                            </el-table-column>
                            <el-table-column prop="picture" label="图片" width="180" height="100 ">
                                <template slot-scope="scope">
                                    <img :src="'http://localhost:9090/NewsReleaseSystem/upload'+scope.row.picture"
                                         alt="新闻图片" width="100px" height="100px">
                                </template>
                            </el-table-column>
                            <el-table-column prop="content" label="内容" :show-overflow-tooltip='true' width="180">
                            </el-table-column>
                            <el-table-column prop="state" label="审核状态" width="100">
                            </el-table-column>
                            <el-table-column lable="操作" width="260">
                                <template slot-scope="scope">
                                    <el-button type="primary" @click="detail(scope.row)">详情</el-button>
                                    <el-button type="primary" @click="open(scope.row)">修改</el-button>
                                    <el-button @click="delete1(scope.row)" type="danger">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </template>

                    <!-- 分页组件 -->
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                                   :current-page="currentPage" :page-sizes="[1, 5, 10, 15, 20]" :page-size="5"
                                   layout="total, sizes, prev, pager, next, jumper" :total="totalCount">
                    </el-pagination>

                    <!-- 修改弹框 -->
                    <el-dialog title="修改数据" :visible.sync="update" width="30%">
                        <el-form ref="new1" :model="new1" label-width="80px">
                            <el-form-item label="新闻标题">
                                <el-input v-model="new1.title"></el-input>
                            </el-form-item>
                            <el-form-item label="文章作者">
                                <el-input v-model="new1.author"></el-input>
                            </el-form-item>
                            <el-form-item label="新闻分类">
                                <el-input v-model="new1.sort"></el-input>
                            </el-form-item>
                            <el-form-item label="分类id">
                                <el-input v-model="new1.sortId"></el-input>
                            </el-form-item>
                            <el-form-item label="新闻内容">
                                <el-input v-model="new1.content"></el-input>
                            </el-form-item>
                            <el-form-item label="审核状态">
                                <el-input v-model="new1.state"></el-input>
                            </el-form-item>
                            <el-form-item>
                                <el-button type="primary" @click="submitForm(),calalOff()">提交</el-button>
                                <el-button @click="calalOff">取消</el-button>
                            </el-form-item>
                        </el-form>
                    </el-dialog>
                </div>
            </div>
        </div>
    </router-view>
</div>

<!-- 官网提供的 axios 在线地址 -->
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<!-- 开发环境版本 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script type="text/javascript" src="../static/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../static/myplugs/js/plugs.js"></script>
<script src="../static/element-ui/lib/index.js"></script>
<link rel="stylesheet" href="../static/element-ui/lib/theme-chalk/index.css" charset="utf-8">

</body>

</html>